package actions;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.logging.log4j.*;


import java.util.Map;



public class LogoutAction extends ActionSupport {
    private Logger logger = LogManager.getLogger(this.getClass());
    public String execute(){
        Map<String,Object> session=null;
        session = ActionContext.getContext().getSession();
        String account = (String)session.get("account");
        if(!account.isEmpty()||!"".equals(account)){
            session.remove("account");
            session.remove("password");
            logger.info("user has been logged out");
        }
        return NONE;
    }
}
